package com.bysc.commonutils.utils;

import java.security.SecureRandom;
import java.util.Base64;

public class CustomIdGenerator {

    private static final int ID_LENGTH = 19; // 指定ID长度

    public static String generateUniqueId() {
        SecureRandom random = new SecureRandom();
        byte[] bytes = new byte[ID_LENGTH];
        random.nextBytes(bytes);
        return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
    }

    public static void main(String[] args) {
        String uniqueId = generateUniqueId();
        System.out.println("Generated unique ID: " + uniqueId);
    }
}

